package com.revzone.demo001.mapper;

import com.revzone.demo001.entity.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
* @author Admin
* @description 针对表【role】的数据库操作Mapper
* @createDate 2025-06-25 10:44:38
* @Entity com.revzone.demo001.entity.Role
*/
@Mapper
public interface RoleMapper_old extends BaseMapper<Role> {
    String getRole(@Param("username")String username);
    Integer findRoleIdByName(@Param("rolename")String rolename);
    //rolename查找permission字段
    List<String> findpermissioncodeByName(@Param("rolename")String rolename);

    // 新增：批量查找权限ID
    @Select("<script>" +
            "SELECT id FROM permission WHERE permissioncode IN " +
            "<foreach item='item' index='index' collection='permissionCodes' open='(' separator=',' close=')'>" +
            "#{item}" +
            "</foreach>" +
            "</script>")
    List<Integer> findIdsByPermissionCodes(@Param("permissionCodes") List<String> permissionCodes);

}




